package mystudy
// 接口定义
import "fmt"

type Persion interface {
	SayHello()
}

type Persion1 interface {
	SayHello()
}
// 定义学生类
type StudentClass01 struct{
	Name string
}

func(s StudentClass01) SayHello(){
	fmt.Println(s, "Student say hello")
}
// 定义教师类
type Teacher struct{
}

func(t Teacher) SayHello(){
	fmt.Println(t, "Teacher say hello")
}

func say(p Persion1){
	p.SayHello()
}
// 其他类型的接口
type integer int

func (i integer)SayHello(){
	fmt.Println("int say hello:", i)
}

func DemoInterface01(){
	var st StudentClass01
	var t Teacher
	var i integer =100
	say(st)
	say(t)
	say(i)
}